<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ 
	taglib prefix="s" uri="/struts-tags"%><%@ 
	include file="/taglibs.jsp"%>
<style type="text/css">
<!--
.checkboxlist ul {
 list-style-type: none; margin: 0; padding: 0; width: 99%;
}
.checkboxlist li {
 float: left; width: 49%;
}
-->
</style>
<h1>使用者维护</h1>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<script type="text/javascript" charset="UTF-8" src="/js/formValidator.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8" src="/js/formValidatorRegex.js" charset="UTF-8"></script>
<script language="javascript">
	$(document).ready( function() {
		$.formValidator.initConfig({formid:"formObj",onerror:function(msg){alert(msg)},onsuccess:function(){return true;}});
		//栏位资料验证

		$("#nameNative").formValidator().inputValidator({	
			min:2,
			max:20,
			onerror:"显示名称须介于2-20个字元之间" });
		$("#email").formValidator().regexValidator({
			regexp:"email",datatype:"enum",
			onerror:"你输入的邮箱格式不正确"});
	});	
</script>

<s:form name="formObj" id="formObj" action="manage/save.do" method="post">
<br />
<table class="tb-data" width="100%">
	<tr>
		<th width="20%">* 登入代码</th>
		<td>
<s:if test="user.modifyDate!=null">
${user.username}<input type="hidden" id="username" value="${user.username}"></input>
</s:if><s:else>
<s:textfield name="user.username" id="username"/>
</s:else>
		</td>
	</tr>
	<tr>
		<th>* 姓名</th>
		<td><s:textfield name="user.nameNative" id="nameNative"/></td>
	</tr>
	<tr>
		<th>* 部门/群组</th>
		<td><s:select list="groups" name="groupCode" listKey="code" listValue="description"/></td>
	</tr>
	<tr>
		<th>* 电子邮件</th>
		<td><s:textfield name="user.email" id="email"/></td>
	</tr>
	<tr>
		<th>电话</th>
		<td><s:textfield name="user.phone"/></td>
	</tr>
	<tr>
		<th>手机</th>
		<td><s:textfield name="user.mobile"/></td>
	</tr>
	<tr>
		<th>狀態</th>
		<td><s:select name="user.status" list="userStatus.options" listKey="key" listValue="value.name"/></td>
	</tr>
	<tr>
		<th>一般角色</th>
		<td><s:checkboxlist name="grantOtherRoles" list="otherRoles" listKey="name" listValue="description" template="checkboxlist2"/></td>
	</tr>
	<tr>
		<th>館線角色</th>
		<td><s:checkboxlist name="grantCategoryRoles" list="categoryRoles" listKey="name" listValue="description" template="checkboxlist2"/></td>
	</tr>
	<tr>
		<th>館線主管</th>
		<td><s:checkboxlist name="grantLinepmRoles" list="linepmRoles" listKey="name" listValue="description" template="checkboxlist2"/></td>
	</tr>
	<tr>
		<th>主管角色</th>
		<td><s:checkboxlist name="grantManageRoles" list="managerRoles" listKey="name" listValue="keyDesc" template="checkboxlist2"/></td>
	</tr>
	<tr>
		<td colspan="2">
			<div class="f-link">
				<input type="submit" value="储存修改">
<s:if test="user.modifyDate!=null">
				<input type="button" onclick="document.location='view.do'" value="回检视页">
</s:if><s:else>
				<input type="button" onclick="document.location='search.do'" value="回查询页">
</s:else>
			</div>
		</td>
	</tr>		
</table>
</s:form>

